<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>项目列表 - 我的作品集</title>
    <link rel="stylesheet" href="css/global.css">
    <link rel="stylesheet" href="css/navbar.css">
    <link rel="stylesheet" href="css/projects.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>
<body>
    <nav class="navbar">
        <div class="logo">
            <a href="index.html">PORTFOLIO</a>
        </div>
        <div class="nav-right">
            <a href="projects.html" class="projects-link">项目列表</a>
            <button class="menu-button" onclick="toggleMenu()">
                <span class="menu-line"></span>
                <span class="menu-line"></span>
                <span class="menu-line"></span>
            </button>
        </div>
    </nav>

    <div class="page-banner">
        <div class="banner-content">
            <h1>我的项目</h1>
            <p>探索我的创意世界</p>
        </div>
    </div>

    <div class="projects-page">
        <div class="project-grid" id="project-grid">
            <!-- 项目卡片将通过 JavaScript 动态生成 -->
        </div>
    </div>

    <script src="js/projectsData.js"></script>
    <script>
        // 生成项目卡片
        function createProjectCards() {
            const projectGrid = document.getElementById('project-grid');
            if (!projectGrid) return;

            projects.forEach(project => {
                const card = document.createElement('div');
                card.className = 'project-card';
                card.style.backgroundImage = `url('${project.backgroundImage}')`;

                const overlay = document.createElement('div');
                overlay.className = 'card-overlay';

                const content = document.createElement('div');
                content.className = 'card-content';

                const title = document.createElement('h3');
                title.textContent = project.title;

                const summary = document.createElement('p');
                summary.textContent = project.summary;

                const tags = document.createElement('div');
                tags.className = 'card-tags';
                project.tags.forEach(tag => {
                    const tagSpan = document.createElement('span');
                    tagSpan.className = 'tag';
                    tagSpan.textContent = tag;
                    tags.appendChild(tagSpan);
                });

                content.appendChild(title);
                content.appendChild(summary);
                content.appendChild(tags);
                overlay.appendChild(content);
                card.appendChild(overlay);

                const link = document.createElement('a');
                link.href = `project-detail.html?id=${project.id}`;
                link.appendChild(card);

                projectGrid.appendChild(link);
            });
        }

        // 页面加载时初始化
        document.addEventListener('DOMContentLoaded', createProjectCards);
    </script>

    <script src="js/main.js"></script>
</body>
</html>
